package com.kila.aop;

import org.aopalliance.intercept.Joinpoint;
import org.aspectj.lang.ProceedingJoinPoint;

public class LogSchema  {


    //前置通知
      public void myBefore(){
          System.out.println(">>>>Sechma 前置通知");
      }


      //后置通知
      public void myAfter(){
          System.out.println(">>>>Sechma 后置通知");
      }


      //错误通知
      public void myException(Joinpoint jp){
          System.out.println(">>>>Sechma 错误通知"+jp.getThis());

      }


      //环绕通知
      public void myAground(ProceedingJoinPoint proceedingJoinPoint){
              Object obj = null;
              if(proceedingJoinPoint!=null)
              {
                 obj= proceedingJoinPoint.getThis();
              }

               System.out.println("schema 环绕通知 前置通知");
              try{
                  proceedingJoinPoint.proceed();
                  System.out.println("schema 环绕通知 后置通知");
              }catch (Throwable e){
                  System.out.println("schema 环绕通知 错误通知");

              }finally {
                  System.out.println("schema 环绕通知 最终通知");

              }

      }
}
